/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package exatrez.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author fikri
 */
@Entity
@Table(name = "vessel_group")
@NamedQueries({
    @NamedQuery(name = "VesselGroup.findAll", query = "SELECT v FROM VesselGroup v")})
public class VesselGroup implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "vessel_group_id")
    private Integer vesselGroupId;
    
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "user_id")
    private User user;
    
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "vessel_id")
    private Vessel vessel;
    
    @Column(name = "active")
    private Character active;
    @Embedded
    private InfoAudit infoAudit;

    public VesselGroup() {
    }

    public VesselGroup(Integer vesselGroupId) {
        this.vesselGroupId = vesselGroupId;
    }
    

    public Integer getVesselGroupId() {
        return vesselGroupId;
    }

    public void setVesselGroupId(Integer vesselGroupId) {
        this.vesselGroupId = vesselGroupId;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Vessel getVessel() {
        return vessel;
    }

    public void setVessel(Vessel vessel) {
        this.vessel = vessel;
    }

    

    public Character getActive() {
        return active;
    }

    public void setActive(Character active) {
        this.active = active;
    }

    public InfoAudit getInfoAudit() {
        return infoAudit;
    }

    public void setInfoAudit(InfoAudit infoAudit) {
        this.infoAudit = infoAudit;
    }

    

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (vesselGroupId != null ? vesselGroupId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof VesselGroup)) {
            return false;
        }
        VesselGroup other = (VesselGroup) object;
        if ((this.vesselGroupId == null && other.vesselGroupId != null) || (this.vesselGroupId != null && !this.vesselGroupId.equals(other.vesselGroupId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "exatrez.model.VesselGroup[ vesselGroupId=" + vesselGroupId + " ]";
    }
    
}
